<?php

namespace app\admin\validate\finance;

use ShidianUtil\Thinkphp\Validate\BaseValidate;

/**
 * Class Bill
 * @package app\admin\validate\finance
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037623
 * @see \app\admin\controller\finance\Bill
 */
class Bill extends BaseValidate
{

    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id'	=> 'isId',
		'fromType'	=> 'scalar|max:16',
		'fromMemberId'	=> 'integer|max:11',
		'fromAccountNumber'	=> 'scalar|max:255',
		'fromBeforeMoney'	=> 'numeric',
		'fromAfterMoney'	=> 'numeric',
		'toType'	=> 'scalar|max:16',
		'toMemberId'	=> 'integer|max:11',
		'toAccountNumber'	=> 'scalar|max:255',
		'toBeforeMoney'	=> 'numeric',
		'toAfterMoney'	=> 'numeric',
		'accountType'	=> 'scalar|max:16',
		'money'	=> 'numeric',
		'type'	=> 'scalar|max:16',
		'billType'	=> 'scalar|max:16',
		'desc'	=> 'scalar|max:255',
		'tradeId'	=> 'integer|max:11',
		'transferId'	=> 'integer|max:11',
		'cashId'	=> 'integer|max:11',
		'sourceId'	=> 'integer|max:11',
		'updated'	=> 'integer|max:11',
		'created'	=> 'integer|max:11',
        'page'      => 'integer|egt:0|max:11',
        'page_size' => 'integer|egt:0|max:11',
    ];

    protected $field = [
        'id'	=> 'id',
		'fromType'	=> 'fromType',
		'fromMemberId'	=> 'fromMemberId',
		'fromAccountNumber'	=> 'fromAccountNumber',
		'fromBeforeMoney'	=> 'fromBeforeMoney',
		'fromAfterMoney'	=> 'fromAfterMoney',
		'toType'	=> 'toType',
		'toMemberId'	=> 'toMemberId',
		'toAccountNumber'	=> 'toAccountNumber',
		'toBeforeMoney'	=> 'toBeforeMoney',
		'toAfterMoney'	=> 'toAfterMoney',
		'accountType'	=> 'accountType',
		'money'	=> 'money',
		'type'	=> 'type',
		'billType'	=> 'billType',
		'desc'	=> 'desc',
		'tradeId'	=> 'tradeId',
		'transferId'	=> 'transferId',
		'cashId'	=> 'cashId',
		'sourceId'	=> 'sourceId',
		'updated'	=> 'updated',
		'created'	=> 'created',
        'page'      => '分页页数',
        'page_size' => '分页大小',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'id.require'	=> '缺少:attribute',
		'id.isId'	=> '请设置正确的:attribute',
		'fromType.require'	=> '请输入:attribute',
		'fromType.scalar' => ':attribute应该是字符串',
		'fromType.max'	=> ':attribute长度不能超过:rule位',
		'fromMemberId.require'	=> '请输入:attribute',
		'fromMemberId.integer' => ':attribute应该是整数',
		'fromMemberId.max'	=> ':attribute长度不能超过:rule位',
		'fromAccountNumber.require'	=> '请输入:attribute',
		'fromAccountNumber.scalar' => ':attribute应该是字符串',
		'fromAccountNumber.max'	=> ':attribute长度不能超过:rule位',
		'fromBeforeMoney.require'	=> '请输入:attribute',
		'fromBeforeMoney.numeric' => ':attribute应该是数字',
		'fromAfterMoney.require'	=> '请输入:attribute',
		'fromAfterMoney.numeric' => ':attribute应该是数字',
		'toType.require'	=> '请输入:attribute',
		'toType.scalar' => ':attribute应该是字符串',
		'toType.max'	=> ':attribute长度不能超过:rule位',
		'toMemberId.require'	=> '请输入:attribute',
		'toMemberId.integer' => ':attribute应该是整数',
		'toMemberId.max'	=> ':attribute长度不能超过:rule位',
		'toAccountNumber.require'	=> '请输入:attribute',
		'toAccountNumber.scalar' => ':attribute应该是字符串',
		'toAccountNumber.max'	=> ':attribute长度不能超过:rule位',
		'toBeforeMoney.require'	=> '请输入:attribute',
		'toBeforeMoney.numeric' => ':attribute应该是数字',
		'toAfterMoney.require'	=> '请输入:attribute',
		'toAfterMoney.numeric' => ':attribute应该是数字',
		'accountType.require'	=> '请输入:attribute',
		'accountType.scalar' => ':attribute应该是字符串',
		'accountType.max'	=> ':attribute长度不能超过:rule位',
		'money.require'	=> '请输入:attribute',
		'money.numeric' => ':attribute应该是数字',
		'type.require'	=> '请输入:attribute',
		'type.scalar' => ':attribute应该是字符串',
		'type.max'	=> ':attribute长度不能超过:rule位',
		'billType.require'	=> '请输入:attribute',
		'billType.scalar' => ':attribute应该是字符串',
		'billType.max'	=> ':attribute长度不能超过:rule位',
		'desc.require'	=> '请输入:attribute',
		'desc.scalar' => ':attribute应该是字符串',
		'desc.max'	=> ':attribute长度不能超过:rule位',
		'tradeId.require'	=> '请输入:attribute',
		'tradeId.integer' => ':attribute应该是整数',
		'tradeId.max'	=> ':attribute长度不能超过:rule位',
		'transferId.require'	=> '请输入:attribute',
		'transferId.integer' => ':attribute应该是整数',
		'transferId.max'	=> ':attribute长度不能超过:rule位',
		'cashId.require'	=> '请输入:attribute',
		'cashId.integer' => ':attribute应该是整数',
		'cashId.max'	=> ':attribute长度不能超过:rule位',
		'sourceId.require'	=> '请输入:attribute',
		'sourceId.integer' => ':attribute应该是整数',
		'sourceId.max'	=> ':attribute长度不能超过:rule位',
		'updated.require'	=> '请输入:attribute',
		'updated.integer' => ':attribute应该是整数',
		'updated.max'	=> ':attribute长度不能超过:rule位',
		'created.require'	=> '请输入:attribute',
		'created.integer' => ':attribute应该是整数',
		'created.max'	=> ':attribute长度不能超过:rule位',
        'page.require'      => '请输入:attribute',
        'page.integer'      => ':attribute应该是整数',
        'page.egt'          => ':attribute应该大于等于:rule',
        'page.max'          => ':attribute长度不能超过:rule位',
        'page_size.require' => '请输入:attribute',
        'page_size.integer' => ':attribute应该是整数',
        'page_size.egt'     => ':attribute应该大于等于:rule',
        'page_size.max'     => ':attribute长度不能超过:rule位',
    ];

    protected $scene = [
        'delete' => ['id' => 'require'],
        'index'  => ['page', 'page_size'],
        'read'   => ['id' => 'require'],
        'save'   => ['fromType', 'fromMemberId', 'fromAccountNumber', 'fromBeforeMoney', 'fromAfterMoney', 'toType', 'toMemberId', 'toAccountNumber', 'toBeforeMoney', 'toAfterMoney', 'accountType', 'money', 'type', 'billType', 'desc', 'tradeId', 'transferId', 'cashId', 'sourceId', 'updated', 'created'],
    ];

}
